<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">


<p:dialog id="dialogCadastro" modal="true" width="50%" position="top"
	appendTo="@(body)" closable="false" resizable="true" draggable="true"
	widgetVar="dialogCadastroServico" header="Cadastro de Serviço">
	<p:ajax event="close" listener="#{servicoMB.close}"
		update="frmDialogServico" />
	<h:form id="frmDialogServico">

		<h:panelGrid columns="2" width="100%">

			<p:outputLabel value="Codigo:"></p:outputLabel>
			<p:inputText value="#{servicoMB.servicoSelecionado.codigo}"
				disabled="true"></p:inputText>

			<p:outputLabel value="Serviço:" for="iptdescServico"></p:outputLabel>
			<p:inputText id="iptdescServico" onfocus="iptdescServico"
				value="#{servicoMB.servicoSelecionado.descServico}" size="60"
				disabled="#{not servicoMB.incluindo}" required="true"
				requiredMessage="Serviço é obrigatório!" maxlength="80"></p:inputText>

			<p:outputLabel value="Preço:" for="iptpreco"></p:outputLabel>
			<p:inputText id="iptpreco" onfocus="iptdescServico"
				onkeypress="return(mascaras(this,moeda))"
				value="#{servicoMB.servicoSelecionado.valor}" size="15"
				converter="doubleConverter" disabled="#{servicoMB.consultando}"
				required="true" requiredMessage="Preço é obrigatório!"
				maxlength="15"></p:inputText>

			<p:outputLabel value="Acréscimo:" for="iptacrescimo"></p:outputLabel>
			<p:inputText id="iptacrescimo" onfocus="iptacrescimo"
				onkeypress="return(mascaras(this,moeda))"
				value="#{servicoMB.servicoSelecionado.acrescimo}" size="15"
				converter="doubleConverter" disabled="#{servicoMB.consultando}"
				maxlength="15"></p:inputText>
		</h:panelGrid>

		<h:panelGroup id="outputexame">
			<h:panelGrid columns="2">
				<p:outputLabel value="Tipo Serviço:"></p:outputLabel>
				<p:selectOneMenu value="#{servicoMB.servicoSelecionado.tipoServico}"
					required="true" id="selecttipo" filter="true" style="width:200px"
					disabled="#{not servicoMB.incluindo}">
					<f:selectItems value="#{servicoMB.listaTipoServico}"
						var="tipoServico" itemLabel="#{tipoServico.descricao}"
						itemValue="#{tipoServico}"></f:selectItems>

				</p:selectOneMenu>

			</h:panelGrid>
		</h:panelGroup>


		<h:panelGrid columns="2" style="border:0px">
			<p:commandButton value="Confirma"
				actionListener="#{servicoMB.salvar}"
				rendered="#{not servicoMB.consultando}"
				update=":frmTab:tabela,:mensagem"
				oncomplete="validaDialog(args,'dialogCadastroServico','frmDialogServico:dialogCadastro')" />


			<p:commandButton value="Cancela"
				onclick="dialogCadastroServico.hide()" immediate="true" />

		</h:panelGrid>

	</h:form>
</p:dialog>

</html>